# Maintainer: Anatol Pomozov
# Contributor: Tommaso Sardelli <lacapannadelloziotom at gmail dot com>

pkgname=bpftrace
pkgver=0.17.1
pkgrel=1
pkgdesc='High-level tracing language for Linux eBPF'
arch=('loong64' 'x86_64')
url='https://github.com/iovisor/bpftrace'
license=('Apache')
depends=('libelf' 'zlib' 'llvm-libs' 'clang' 'bcc' 'libbpf' 'libpcap')
makedepends=('cmake' 'llvm' 'git' 'linux-headers' 'ninja' 'gtest' 'cereal'
             'asciidoctor' 'xxd')
options=('!strip' '!debug')
source=("https://github.com/iovisor/bpftrace/archive/v$pkgver/bpftrace-$pkgver.tar.gz")
sha512sums=('57f00a0b209d745efe5ce39d0e8efb90a21b5c499b41385814378d828ef507dc2c6d9497f9d23dbb610fcff21f077cba9f7481e7a6a6465825065743289ef4ad')

build() {
  cmake -S bpftrace-$pkgver -B build -G Ninja \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DUSE_SYSTEM_BPF_BCC=ON
  cmake --build build
}

package() {
  DESTDIR="$pkgdir" cmake --install build
}
